Skip to content

FT8TransmitSignal: instrument TX output path with fileLog#87

Merged
patrickrb merged 1 commit into
devfrom
feat/tx-output-logging
Jun 2, 2026
Merged

FT8TransmitSignal: instrument TX output path with fileLog#87
patrickrb merged 1 commit into
devfrom
feat/tx-output-logging

Conversation

@patrickrb
Copy link
Copy Markdown
Owner

Summary

Same Phase-0 logging pattern as the input side that surfaced the real bugs in #82 / #83 — applied to the TX output side because the car-dash TX-abort symptom is still happening despite #84 shipping the libusb nativeWrite.

The relevant clue from the latest car-dash log (debug (3).log):

17:08:15.495 serial.send[4]: MX1;     ← PTT on
17:08:15.757 serial.send[4]: MX0;     ← PTT off 262ms later  ← ABORT

…with zero mention of playFT8Signal / playViaUsbAudio / trying libusb native write / nativeWrite anywhere in the log. Something is aborting TX before our libusb code is reached, and from debug.log we can't tell what.

The whole TX output path (FT8TransmitSignal.playFT8Signal and playViaUsbAudio) logs only to logcat. This PR makes it write fileLog() at the branch decision and at each failure point.

What gets logged

playFT8Signal (the branch point):

playFT8Signal: TX path branch: audioOutputDeviceId=<id> usbAudioOutputVidPid=<vid>:<pid>
playFT8Signal: using USB audio (direct) output      ← or "AudioTrack output (Android default sink)"

playViaUsbAudio (each step):

playViaUsbAudio: start, VID=... PID=... samples=... rate=...
playViaUsbAudio: ABORT USB audio output device not found by VID:PID ...      (or one of:)
playViaUsbAudio: ABORT UsbManager is null
playViaUsbAudio: ABORT no USB permission for output device (re-pick (USB direct) in Settings to re-grant)
playViaUsbAudio: ABORT UsbAudioDevice.open() failed (descriptor parse or claimInterface failed)
playViaUsbAudio: ABORT device has no output endpoint
playViaUsbAudio: ABORT activateOutput(48000) failed (alt-setting select or rate setup failed)
playViaUsbAudio: device opened, output activated at 48000 Hz
playViaUsbAudio: calling writeAudio playLength=... rate=...
playViaUsbAudio: writeAudio returned OK | FAILED

After the next car-dash repro we'll know in one read whether the abort is:

  • audioOutputDeviceId not being -1 at TX time (picker reset?)
  • Device lookup failing (UsbManager state)
  • Permission lost on re-attach
  • activateOutput failing on the car-dash kernel
  • Or actually reaching writeAudio and libusb dying inside (the case nativeWrite already logs)

Test plan

  • assembleDebug compiles clean (APK built fresh).
  • Pixel 8 smoke test — was unplugged at build time. Confirm logs appear on a normal TX, and that the AudioTrack branch path also logs.
  • Car-dash via Play internal after merge: read debug.log, identify the single ABORT line that explains the 262ms PTT release. We then know which next fix to ship.

🤖 Generated with Claude Code

The car-dash TX-abort symptom (PTT keys → 250-300ms → PTT releases,
no audio sent) is still happening despite #84 shipping the libusb
nativeWrite. But the full TX output path is logged only to logcat, so
from debug.log there's no way to tell:

  1. Which output branch ran (USB direct vs. AudioTrack).
  2. If USB direct ran, which step failed before reaching writeAudio
     (device lookup, USB permission, open, hasOutput, activateOutput).

Same instrumentation pattern as the input side that surfaced the real
bugs in #82 / #83.

Changes:
- playFT8Signal: log the branch decision with audioOutputDeviceId and
  the saved USB output VID:PID. Log which branch was taken.
- playViaUsbAudio: fileLog at each failure point and at the success
  pivots (device opened + output activated, before writeAudio,
  writeAudio return value). Every failure path has a distinct
  message so the failure point is obvious from one log line.

After the next car-dash repro we'll know whether the abort is:
- audioOutputDeviceId not being -1 at TX time (picker reset?),
- device lookup failing (UsbManager state),
- permission lost on re-attach,
- activateOutput failing on the car-dash kernel,
- or actually reaching writeAudio and libusb dying inside.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@patrickrb patrickrb merged commit c43d917 into dev Jun 2, 2026
2 checks passed
@patrickrb patrickrb deleted the feat/tx-output-logging branch June 2, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant